import { createRouter, createWebHashHistory } from 'vue-router'
import Login from '../views/Login.vue'
import NotFind from '../views/404.vue'
import About from '../views/about.vue'
import Home from '../views/home'

const routes = [
    // 默认路径自动跳转到Home组件
    {
        path: "/",
        redirect: "/login"
    },
    // 下面匹配规则
    {
        path: '/login',
        component: Login
    },
    {
        path: '/about',
        component: About
    },
    {
        path: '/home',
        component: Home
    },
    {
        path: '/:pathMatch(.*)',
        component: NotFind
    }
]

const router = createRouter({
    history: createWebHashHistory(),
    routes
})

export default router